﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using YArchitech.LIB;

namespace YArchitech.DataModel
{
	public class PipingSystemClassificationOP
	{
		public PipingSystemClassificationOP()
		{
			this.xmlDoc = XMLOperating.LoadXml(Path.Combine(Product.DataLocation, "YJKPipingSystemClassification.xml"));
		}

		public bool IsAirSystem(string name)
		{
			bool result = false;
			new List<string>();
			using (List<string>.Enumerator enumerator = XMLOperating.GetAllNodesText(this.xmlDoc, "piping/air").GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (enumerator.Current == name)
					{
						result = true;
						break;
					}
				}
			}
			return result;
		}

		public bool IsFireSystem(string name)
		{
			bool result = false;
			new List<string>();
			using (List<string>.Enumerator enumerator = XMLOperating.GetAllNodesText(this.xmlDoc, "piping/fire").GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (enumerator.Current == name)
					{
						result = true;
						break;
					}
				}
			}
			return result;
		}

		public bool IsPipeSystem(string name)
		{
			bool result = false;
			new List<string>();
			using (List<string>.Enumerator enumerator = XMLOperating.GetAllNodesText(this.xmlDoc, "piping/pipe").GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					if (enumerator.Current == name)
					{
						result = true;
						break;
					}
				}
			}
			return result;
		}

		private XmlDocument xmlDoc;
	}
}
